<?php /* Smarty version Smarty 3.1.4, created on 2012-05-04 13:46:29
         compiled from ".\templates\product\addimage.tpl" */ ?>
<?php /*%%SmartyHeaderCode:216104fa3ddb5d0a5a2-30797698%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ecfdbd2f841cef51739770b4d857f3b07aa2b6d0' => 
    array (
      0 => '.\\templates\\product\\addimage.tpl',
      1 => 1335689044,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '216104fa3ddb5d0a5a2-30797698',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'title' => 0,
    'productdet_arr' => 0,
    'productid' => 0,
    'productimage_arr' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty 3.1.4',
  'unifunc' => 'content_4fa3ddb5ebfa0',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_4fa3ddb5ebfa0')) {function content_4fa3ddb5ebfa0($_smarty_tpl) {?>
<script language="javascript" type="text/javascript" src="js/ajaxupload.3.5.js"></script>
<script type="text/javascript">
	$(function(){
		var btnUpload=$('#upload');
		var status=$('#status');
		var productid = document.getElementById("productid").value;
                    //document.write($poductid);
		new AjaxUpload(btnUpload, {
			action: 'controller.php?task=addproductimage&productid='+productid,
			name: 'uploadfile',
			onSubmit: function(file, ext){
				 if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
                    // extension is not allowed
					status.text('Only JPG, PNG or GIF files are allowed');
					return false;
				}
		 		status.text('Uploading...');
			},
			onComplete: function(file, response){
                                alert(response);
				//On completion clear the status
				status.text('');
				//Add uploaded file to list
				if(response==="success"){
					loadPage("product/addimage/"+productid);
					$("#message_area").show();
					$("#message_area").html("<span class='success'>Image has been successfully uploaded.</span>");
					$('<li></li>').appendTo('#files').html('<img src="../images/products/thumbs/'+file+'" alt="" /><br />').addClass('success');
				} else{
					//$('<li></li>').appendTo('#files').text(file).addClass('error');
					loadPage("product/addimage/"+productid);
					$("#message_area").show();
					$("#message_area").html("<span class='error'>Sorry. Image is already uploaded. Please select another image.</span>");
					
				}
			}
		});
		
	});
</script>

<div id="page-heading">
	<h1><?php echo $_smarty_tpl->tpl_vars['title']->value;?>
</h1>
        <?php if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3'])) unset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['name'] = 'sec3';
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['productdet_arr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['show']) {
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['loop'];
    if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['total'] == 0)
        $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['show'] = false;
} else
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['show']):

            for ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration'] = 1;
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['total'];
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['first']      = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['last']       = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['sec3']['total']);
?>
        <h2><?php echo $_smarty_tpl->tpl_vars['productdet_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec3']['index']]['title'];?>
</h2>
         <h3><?php echo $_smarty_tpl->tpl_vars['productdet_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec3']['index']]['add_id'];?>
</h3>
         <br>
         <a onclick="loadPage('product/index')" href="javascript: void(0);">Back to product list</a>
          &nbsp;
           <a onclick="loadPage('product/addproduct/101000100001');" href="javascript: void(0);">Add new product</a>
          &nbsp;
         <a onclick="loadPage('product/editproduct/<?php echo $_smarty_tpl->tpl_vars['productid']->value;?>
');" href="javascript: void(0);">Back to prodcuct details</a>
   &nbsp;
         <a onclick="loadPage('product/addfeatures/<?php echo $_smarty_tpl->tpl_vars['productid']->value;?>
');" href="javascript: void(0);">Add Product features</a>

            <?php endfor; endif; ?>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="15%" height="100" align="center" valign="top">		
			<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
          		<tr>
            		<th align="left" class="table-header-repeat">&nbsp;</th>
          		</tr>
          		<tr>
            		<td>
            			<div id="upload">Upload File</div>
                                <div style="color: red;">Please Upload only box images</div>
            			<input type="hidden" name="productid" id="productid" value="<?php echo $_smarty_tpl->tpl_vars['productid']->value;?>
"/>
            			<!--<div id="browsegallery" onclick="browseAll();"><span>Browse All<span></div>    -->        	
            		</td>
          		</tr>
      		</table>
      	</td>
      	<td width="2%">&nbsp;</td>	
        <td width="35%" valign="top" align="center">
        	<span id="status" ></span>		
			<ul id="files" ></ul>			
			<?php if (!empty($_smarty_tpl->tpl_vars['productimage_arr']->value)){?>
			<div id="showimages">
				<ul id="product_files">
					<?php if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1'])) unset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['name'] = 'sec1';
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'] = is_array($_loop=$_smarty_tpl->tpl_vars['productimage_arr']->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']) {
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
    if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] == 0)
        $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = false;
} else
    $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']):

            for ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] = 1;
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'];
                 $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['first']      = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['last']       = ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total']);
?>
						<li><img src="../images/products/<?php echo $_smarty_tpl->tpl_vars['productimage_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['filename'];?>
" alt="" /><br /><a href="javascript: void(0);" onclick="delProductImage(<?php echo $_smarty_tpl->tpl_vars['productid']->value;?>
,<?php echo $_smarty_tpl->tpl_vars['productimage_arr']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['image_id'];?>
)"><img src="images/icons/remove.png" class="cursor" /> Delete this image</a></li>
					<?php endfor; endif; ?>
				</ul>
			</div>
			<?php }else{ ?>
			<div id="showimages">Sorry. No image assign for this item</div>
			<?php }?>
        </td>		
	</tr>	
</table><?php }} ?>